home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1994 February: Tool Chest / Dev.CD Feb 94.toast / Tool Chest / Development Platforms / MPW Related / MPW Interfaces / AIncludes / Components.a < prev    next >
Encoding:
Text File  |  1993-09-17  |  17.1 KB  |  323 lines  |  [TEXT/MPS ]

  1. ;___________________________________________________________________________
  2. ; Created: Wednesday, April 21, 1993
  3. ;
  4. ; File: Components.a
  5. ;
  6. ; Assembler Interface to the Macintosh Libraries
  7. ; Copyright Apple Computer, Inc. 1990-93
  8. ; All Rights Reserved
  9. ;
  10. ;___________________________________________________________________________
  11.  
  12.  IF &TYPE('__IncludingComponents__') = 'UNDEFINED' THEN
  13. __IncludingComponents__   SET 1
  14.  
  15. gestaltComponentMgr                               EQU      'cpnt'
  16.  
  17. kAnyComponentType                                  EQU        0
  18. kAnyComponentSubType                              EQU        0
  19. kAnyComponentManufacturer                          EQU        0
  20. kAnyComponentFlagsMask                              EQU        0
  21.  
  22. cmpWantsRegisterMessage                              EQU      $80000000
  23.  
  24. ;Component Resource Extension flags
  25. componentDoAutoVersion                 EQU     1
  26. componentWantsUnregister            EQU     2
  27. componentAutoVersionIncludeFlags    EQU        4
  28.  
  29. ComponentDescription                              RECORD   0
  30. componentType                                     DS.L       1                       ; A unique 4-byte code indentifying the command set 
  31. componentSubType                                  DS.L       1                       ; Particular flavor of this instance 
  32. componentManufacturer                             DS.L       1                       ; Vendor indentification 
  33. componentFlags                                    DS.L       1                       ; 8 each for Component,Type,SubType,Manuf/revision 
  34. componentFlagsMask                                DS.L       1                       ; Mask for specifying which flags to consider in search, zero during registration 
  35. size                                              EQU      *
  36.                                                   ENDR
  37.  
  38. ResourceSpec                                      RECORD   0
  39. resType                                           DS.L       1                         ; 4-byte code  
  40. resId                                             DS.W       1
  41. size                                              EQU      *
  42.                                                   ENDR
  43.  
  44. ComponentResource                                 RECORD   0
  45. cd                                                DS       ComponentDescription     ; Registration parameters 
  46. component                                         DS       ResourceSpec             ; resource where Component code is found 
  47. componentName                                     DS       ResourceSpec             ; name string resource 
  48. componentInfo                                     DS       ResourceSpec             ; info string resource 
  49. componentIcon                                     DS       ResourceSpec             ; icon resource 
  50. size                                              EQU      *
  51.                                                   ENDR
  52.                                                   
  53. ComponentResourceExtension                        RECORD    0
  54. componentVersion                                DS.L    1            ; version of Component 
  55. componentRegisterFlags                            DS.L    1            ; flags for registration 
  56. componentIconSuite                                DS.W    1            ; resource id of Icon Suite 
  57. size                                            EQU        *
  58.                                                 ENDR
  59.  
  60. ; Structure received by Component:  
  61. ComponentParameters                               RECORD   0
  62. flags                                             DS.B     1                           ; call modifiers: sync/async, deferred, immed, etc 
  63. paramSize                                         DS.B     1                           ; size in bytes of actual parameters passed to this call 
  64. what                                              DS.W       1                        ; routine selector, negative for Component management calls 
  65. params                                            DS.L     1                        ; actual parameters for the indicated routine 
  66. size                                              EQU      *
  67.                                                   ENDR
  68.  
  69.  
  70.  
  71. ;*******************************************************
  72. ;*                                                     *
  73. ;*              APPLICATION LEVEL CALLS                *
  74. ;*                                                     *
  75. ;*******************************************************
  76. ;* Component Database Add, Delete, and Query Routines 
  77. ;*******************************************************
  78.                                                   MACRO
  79.                                                   _RegisterComponent
  80.                                                   MOVEQ        #$01,D0
  81.                                                   DC.W         $A82A      ; TB 002A
  82.                                                   ENDM
  83.  
  84.                                                   MACRO
  85.                                                   _RegisterComponentResource
  86.                                                   MOVEQ        #$12,D0
  87.                                                   DC.W         $A82A      ; TB 002A
  88.                                                   ENDM
  89.  
  90.                                                   MACRO
  91.                                                   _UnregisterComponent
  92.                                                   MOVEQ        #$02,D0
  93.                                                   DC.W         $A82A      ; TB 002A
  94.                                                   ENDM
  95.  
  96.  
  97.                                                   MACRO
  98.                                                   _FindNextComponent
  99.                                                   MOVEQ        #$04,D0
  100.                                                   DC.W         $A82A      ; TB 002A
  101.                                                   ENDM
  102.  
  103.                                                   MACRO
  104.                                                   _CountComponents
  105.                                                   MOVEQ        #$03,D0
  106.                                                   DC.W         $A82A      ; TB 002A
  107.                                                   ENDM
  108.  
  109.  
  110.                                                   MACRO
  111.                                                   _GetComponentInfo
  112.                                                   MOVEQ        #$05,D0
  113.                                                   DC.W         $A82A      ; TB 002A
  114.                                                   ENDM
  115.  
  116.                                                   MACRO
  117.                                                   _GetComponentListModSeed
  118.                                                   MOVEQ        #$06,D0
  119.                                                   DC.W         $A82A      ; TB 002A
  120.                                                   ENDM
  121.  
  122.  
  123. ;*******************************************************
  124. ;* Component Instance Allocation and dispatch routines 
  125. ;*******************************************************
  126.                                                   MACRO
  127.                                                   _OpenComponent
  128.                                                   MOVEQ        #$07,D0
  129.                                                   DC.W         $A82A      ; TB 002A
  130.                                                   ENDM
  131.  
  132.                                                   MACRO
  133.                                                   _CloseComponent
  134.                                                   MOVEQ        #$08,D0
  135.                                                   DC.W         $A82A      ; TB 002A
  136.                                                   ENDM
  137.  
  138.  
  139.                                                   MACRO
  140.                                                   _GetComponentInstanceError
  141.                                                   MOVEQ        #$0A,D0
  142.                                                   DC.W         $A82A      ; TB 002A
  143.                                                   ENDM
  144.  
  145.  
  146. ; direct calls to the Components 
  147.                                                   MACRO
  148.                                                   _ComponentFunctionImplemented
  149.                                                   MOVE.L       #$0002FFFD,-(A7)
  150.                                                   MOVEQ        #$00,D0
  151.                                                   DC.W         $A82A      ; TB 002A
  152.                                                   ENDM
  153.  
  154.                                                   MACRO
  155.                                                   _GetComponentVersion
  156.                                                   MOVE.L       #$0000FFFC,-(A7)
  157.                                                   MOVEQ        #$00,D0
  158.                                                   DC.W         $A82A      ; TB 002A
  159.                                                   ENDM
  160.  
  161. ;****************************************************
  162. ;*                                                    *
  163. ;*               CALLS MADE BY Components             *
  164. ;*                                                    *
  165. ;******************************************************
  166. ;******************************************************
  167. ;* Required Component routines
  168. ;******************************************************
  169. kComponentOpenSelect                              EQU      -1                       ; ComponentInstance for this open 
  170. kComponentCloseSelect                             EQU      -2                       ; ComponentInstance for this close 
  171. kComponentCanDoSelect                             EQU      -3                       ; selector # being queried 
  172. kComponentVersionSelect                           EQU      -4                       ; no params 
  173. kComponentRegisterSelect                          EQU      -5                       ; no params 
  174. kComponentTargetSelect                            EQU      -6                       ; ComponentInstance for top of call chain 
  175. kComponentUnregisterSelect                           EQU        -7                        ; no params 
  176.  
  177. ;*******************************************************
  178. ;* Component Management routines
  179. ;*******************************************************
  180.                                                   MACRO
  181.                                                   _SetComponentInstanceError
  182.                                                   MOVEQ        #$0B,D0
  183.                                                   DC.W         $A82A      ; TB 002A
  184.                                                   ENDM
  185.  
  186.  
  187.                                                   MACRO
  188.                                                   _GetComponentRefcon
  189.                                                   MOVEQ        #$10,D0
  190.                                                   DC.W         $A82A      ; TB 002A
  191.                                                   ENDM
  192.  
  193.                                                   MACRO
  194.                                                   _SetComponentRefcon
  195.                                                   MOVEQ        #$11,D0
  196.                                                   DC.W         $A82A      ; TB 002A
  197.                                                   ENDM
  198.  
  199.  
  200.                                                   MACRO
  201.                                                   _OpenComponentResFile
  202.                                                   MOVEQ        #$15,D0
  203.                                                   DC.W         $A82A      ; TB 002A
  204.                                                   ENDM
  205.  
  206.                                                   MACRO
  207.                                                   _CloseComponentResFile
  208.                                                   MOVEQ        #$18,D0
  209.                                                   DC.W         $A82A      ; TB 002A
  210.                                                   ENDM
  211.  
  212.  
  213. ;*******************************************************
  214. ;* Component Instance Management routines
  215. ;*******************************************************
  216.                                                   MACRO
  217.                                                   _GetComponentInstanceStorage
  218.                                                   MOVEQ        #$0C,D0
  219.                                                   DC.W         $A82A      ; TB 002A
  220.                                                   ENDM
  221.  
  222.                                                   MACRO
  223.                                                   _SetComponentInstanceStorage
  224.                                                   MOVEQ        #$0D,D0
  225.                                                   DC.W         $A82A      ; TB 002A
  226.                                                   ENDM
  227.  
  228.  
  229.                                                   MACRO
  230.                                                   _GetComponentInstanceA5
  231.                                                   MOVEQ        #$0E,D0
  232.                                                   DC.W         $A82A      ; TB 002A
  233.                                                   ENDM
  234.  
  235.                                                   MACRO
  236.                                                   _SetComponentInstanceA5
  237.                                                   MOVEQ        #$0F,D0
  238.                                                   DC.W         $A82A      ; TB 002A
  239.                                                   ENDM
  240.  
  241.  
  242.                                                   MACRO
  243.                                                   _CountComponentInstances
  244.                                                   MOVEQ        #$13,D0
  245.                                                   DC.W         $A82A      ; TB 002A
  246.                                                   ENDM
  247.  
  248.  
  249. ; useful helper routines for convenient method dispatching 
  250.                                                   MACRO
  251.                                                   _CallComponentFunction
  252.                                                   MOVEQ        #$FF,D0
  253.                                                   DC.W         $A82A      ; TB 002A
  254.                                                   ENDM
  255.  
  256.                                                   MACRO
  257.                                                   _CallComponentFunctionWithStorage
  258.                                                   MOVEQ        #$FF,D0
  259.                                                   DC.W         $A82A      ; TB 002A
  260.                                                   ENDM
  261.  
  262.                                                   MACRO
  263.                                                   _DelegateComponentCall
  264.                                                   MOVEQ        #$24,D0
  265.                                                   DC.W         $A82A      ; TB 002A
  266.                                                   ENDM
  267.  
  268. ; Set Default Component flags 
  269. defaultComponentIdentical                         EQU      0
  270. defaultComponentAnyFlags                          EQU      1
  271. defaultComponentAnyManufacturer                   EQU      2
  272. defaultComponentAnySubType                        EQU      4
  273. defaultComponentAnyFlagsAnyManufacturer           EQU      defaultComponentAnyFlags+defaultComponentAnyManufacturer
  274. defaultComponentAnyFlagsAnyManufacturerAnySubType EQU      defaultComponentAnyFlags+defaultComponentAnyManufacturer+defaultComponentAnySubType
  275.  
  276.                                                   MACRO
  277.                                                   _SetDefaultComponent
  278.                                                   MOVEQ        #$1E,D0
  279.                                                   DC.W         $A82A      ; TB 002A
  280.                                                   ENDM
  281.  
  282.                                                   MACRO
  283.                                                   _OpenDefaultComponent
  284.                                                   MOVEQ        #$21,D0
  285.                                                   DC.W         $A82A      ; TB 002A
  286.                                                   ENDM
  287.  
  288.                                                   MACRO
  289.                                                   _CaptureComponent
  290.                                                   MOVEQ        #$1C,D0
  291.                                                   DC.W         $A82A      ; TB 002A
  292.                                                   ENDM
  293.  
  294.                                                   MACRO
  295.                                                   _UncaptureComponent
  296.                                                   MOVEQ        #$1D,D0
  297.                                                   DC.W         $A82A      ; TB 002A
  298.                                                   ENDM
  299.  
  300.                                                   MACRO
  301.                                                   _RegisterComponentResourceFile
  302.                                                   MOVEQ        #$14,D0
  303.                                                   DC.W         $A82A      ; TB 002A
  304.                                                   ENDM
  305.  
  306.                                                   MACRO
  307.                                                   _GetComponentIconSuite
  308.                                                   MOVEQ        #$2A,D0
  309.                                                   DC.W         $A82A      ; TB 002A
  310.                                                   ENDM
  311.  
  312.  
  313. ; errors from component manager & components
  314. invalidComponentID                                  EQU        -3000
  315. validInstancesExist                                  EQU        -3001
  316. componentNotCaptured                              EQU        -3002
  317. componentDontRegister                              EQU        -3003
  318.  
  319. badComponentInstance                              EQU        $80008001
  320. badComponentSelector                              EQU        $80008002
  321.  
  322.  
  323.                                                   ENDIF    ;   ...already included